package cn.itcast.controller.stat;

import cn.itcast.controller.BaseController;
import cn.itcast.service.stat.StatService;

import com.alibaba.dubbo.config.annotation.Reference;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;
import java.util.Map;

@Controller
@RequestMapping("/stat")
public class StatController extends BaseController {

    @Reference
    private StatService statService;

    @RequestMapping(value = "/toCharts",name = "进入到统计页面")
    public String  toCharts(String chartsType){

        return "stat/stat-"+chartsType;
    }


    @ResponseBody
    @RequestMapping(value = "/factoryCharts",name = "生产厂家销售情况")
    public List<Map> factoryCharts(){

        return  statService.factoryCharts(getCompanyId());

    }


    @ResponseBody
    @RequestMapping(value = "/onlineCharts",name = "产品销售排行")
    public  List<Map>  onlineCharts(){


        return statService.onlineCharts(getCompanyId());


    }

    @ResponseBody
    @RequestMapping(value = "/sellCharts",name = "系统访问压力图")
    public  List<Map> sellCharts(){


        return statService.sellCharts(getCompanyId());

    }

}
